<template>
	<view class="pages">
		<view class="content">
			<view class="contentTop">
				<image src="../../static/Logoblue.jpg" mode="" style="width: 100%;height: 100%;"> </image>
			</view>
			<image src="../../static/border.png" mode=""
				style="width: 380rpx;height: 380rpx;margin: 168rpx auto 0;position: relative;"> </image>
			<image :src="userInfo.code_url" mode=""
				style="width: 330rpx;height: 330rpx;position: absolute;top: 540rpx;"> </image>
			<view class="tps">
				<!-- Peiran Li -->
				{{userInfo.real_name || ''}}
			
			</view>
	<!-- 		<view class="ids">
				Sponsor ID：{{userInfo.pid || ''}}
			</view> -->

			<u-button type="primary" :text="$t('saveCode')"
				:customStyle="{width:'640rpx',height:'80rpx',backgroundColor:'#273562',color:'#fff',fontWeight:'700',border:'none',borderRadius: '16rpx',marginTop:'160rpx'}"
				@click="save(userInfo.code_url)"></u-button>

		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {
					...JSON.parse(uni.getStorageSync('user'))
				}
			}
		},
		onShow() {},
		methods: {
			// 图片存相册
			save(imgurl) {
				let tip = 'saveImg'
				this.$savePhoto(imgurl, tip)
			},
			// 分享二维码
			share() {
				let that = this
				uni.showLoading({
					title: that.$t('loading')
				});
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 2,
					imageUrl: `${this.userInfo.code_url}`,
					success: function(res) {
						uni.hideLoading()
						console.log("success:" + JSON.stringify(res));
					},
					fail: function(err) {
						uni.hideLoading()
						console.log("fail:" + JSON.stringify(err));
					}
				});
			}

		}
	}
</script>

<style>
	.pages {
		width: 100%;
		height: 100vh;
		overflow-y: auto;
		box-sizing: border-box;
		background-color: #F0F0F0;
		padding: 30rpx 30rpx 40rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: center;
		width: 100%;
		height: 100%;
		background-color: #fff;
		background-image: url('');
		background-repeat: no-repeat;
		background-size: 65% 200rpx;
		background-position: right 86%;
	}

	.contentTop {
		width: 100%;
		height: 300rpx;
	}

	.tps {
		font-family: Montserrat;
		font-size: 56rpx;
		font-weight: 700;
		letter-spacing: 0.20000000298023224px;
		text-align: center;
		margin-top: 50rpx;
	}

	.ids {
		font-family: Montserrat;
		font-size: 32rpx;
		font-weight: 700;
		letter-spacing: 0.20000000298023224px;
		text-align: center;
		color: #273562;
		margin-top: 30rpx;
	}

	.saveBox {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		height: 80rpx;
		margin-top: 80rpx;
	}
</style>